package com.systemic.mapper;

import com.systemic.pojo.Dynamic;
import com.systemic.pojo.DynamicImage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @ClassName: DynamicMapper
 * @Description: 动态mapper
 * @Author:
 * @CreateTime: 2024-01-05 10:48
 * @Version:
 **/
@Mapper
public interface DynamicMapper {

    int insert(Dynamic dynamic);

    int delete(Dynamic dynamic);

    int update(Dynamic dynamic);

    Dynamic selectById(@Param("id") Integer id);

    List<Dynamic> selectListByUid(@Param("uid") Integer uid);

    /**
     * 前台：偏移量分页查询
     * @param uid
     * @param offset
     * @param pageSize
     * @return
     */
    List<Dynamic> selectListByUidPage(@Param("uid") Integer uid, @Param("offset") Integer offset, @Param("pageSize") Integer pageSize);

    /**
     * 获取自增的id
     * @return
     */
    @Select("SELECT LAST_INSERT_ID()")
    Integer getLastInsertId();

    /**
     * 后台：偏移量分页查询
     * @param offset
     * @param pageSize
     * @return
     */
    List<Dynamic> selectListPage(@Param("offset") Integer offset, @Param("pageSize") Integer pageSize);

    /**
     * 管理端：批量删除
     * @param idList
     * @return
     */
    int deleteBatchIds(@Param("idList") List<Integer> idList);
}
